<?
include_once "JCAT_WidgetLookup.class.php" ;



class JCAT_GtkDialog
{
	function JCAT_GtkDialog()
	{
		$this->aWidgetLookup = new JCAT_WidgetLookup() ;
	}
	
	private $aWidgetLookup = null ;
	
	private $aDialogWidget = null ;

	public function AddWidgetName($sName,$sClass='')
	{ $this->aWidgetLookup->AddWidgetName($sName,$sClass) ; }

	public function LoopupWidget()
	{ $this->aWidgetLookup->Lookup($this->aDialogWidget) ; }
	
	public function GetChildWidget($sName)
	{ return $this->aWidgetLookup->GetWidget($sName) ; }
	
	public function CreateByGlade($sPath,$sDlgName)
	{
		$aGlade = new GladeXML($sPath,$sDlgName) ;
		$this->aDialogWidget = $aGlade->get_widget($sDlgName) ;
		if( !$this->aDialogWidget )
		{
			print "从 {$sPath} 文件中创建对话框：$sDlgName 失败。\r\n";
			return false ;
		}
		
		$this->LoopupWidget() ;
		return true ;
	}
	
	public function __call($sMethod,$arrArgvs)
	{
		if( !$this->aDialogWidget )
			return ;

		if( method_exists($this->aDialogWidget,$sMethod) )
			return call_user_func_array( array($this->aDialogWidget,$sMethod),$arrArgvs) ;
		else
			print "正在访问的方法：".get_class($this->aDialogWidget)."::$sMethod 不存在。" ;
	}
	
	public function GetWidget()
	{ return $this->aDialogWidget ; }

	public function Serialize(JCAT_Archive $aArchive)
	{ $aArchive->DoIt() ; }
}

?>